import React, { Component } from 'react';
import $ from 'jquery';
import "../styles/starnews.css";
class Starnews extends Component{
constructor(props) {
      super(props);
      this.state = {
          goodsinfo:[] 
      }
  }
	componentWillMount(){
	    let that = this;
	    $.get("http://route.showapi.com/231-1",{
	      	showapi_appid: 41467,
			showapi_sign: 'fc090ece3fed4ab5988e0483ecd0d5cf',
	    	num:"50",
	    	page:1
	    },
	        function(res){
	        	if(res&&res.showapi_res_code===0){
	        		var listInfo = res.showapi_res_body.newslist;
	        		
		        	console.log(listInfo);

			      	that.setState({
		            	goodsinfo:listInfo
	            });
	        	}
	        	
	        },"json")
    }

	render(){
		var itemarr = this.state.goodsinfo.map((item,i)=>{
		    return (
		    	<div key={i} className="contain">
			    	<div className="liebiao">
							<img src={item.picUrl} alt=""/>
							<div className="newscon">
									<p>时间:{item.ctime}</p>
									<p>描述:{item.description}</p>
									<p>标题:{item.title}</p>
							</div>
						</div>
					</div>
		    )
		})
		
		return(
			<div className="xzcon">
					{itemarr}
			</div>
		)
	}
}
export default Starnews;
